package com.mp.approvalreq.dao;

import com.mp.approvalreq.entity.GroupContent;
import com.mp.approvalreq.entity.Leave;
import com.mp.approvalreq.entity.Outdoor;
import com.mp.approvalreq.entity.TemplateComponent;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * @author xq
 */
public interface ComponentDao {
    /**
     * 根据审批id批量获取组件集合
     *
     * @param requestId
     * @return
     * @throws SQLException
     */
    List<TemplateComponent> selectComponentByRequestId(Integer requestId) throws SQLException;

    /**
     * 根据审批id批量获取组件集合
     *
     * @param requestIds
     * @return
     * @throws SQLException
     */
    Map<Integer, List<TemplateComponent>> selectComponentMapByRequestIds(String requestIds) throws SQLException;

    /**
     * 批量插入组件
     *
     * @param components
     * @throws SQLException
     */
    void insertBatchComponent(List<TemplateComponent> components) throws SQLException;

    /**
     * 批量插入组件集
     *
     * @param components
     * @throws SQLException
     */
    void insertBatchGroupComponent(List<TemplateComponent> components) throws SQLException;

    /**
     * 根据审批id分组获取组件集内容
     *
     * @param requestId
     * @return
     * @throws SQLException
     */
    Map<Integer, List<GroupContent>> selectGroupComponentByRequestId(Integer requestId) throws SQLException;

    /**
     * 根据审批id批量分组获取组件集内容
     *
     * @param requestIds
     * @return
     * @throws SQLException
     */
    Map<Integer, Map<Integer, List<GroupContent>>> selectGroupComponentByRequestIds(String requestIds) throws SQLException;

    /**
     * 修改外勤（外出/出差）结束时间
     *
     * @param outdoor
     * @param timeNum
     */
    void updateOutdoorEndTimeComponent(Outdoor outdoor, Integer timeNum) throws SQLException;

    /**
     * 批量修改组件
     *
     * @param components
     * @throws SQLException
     */
    void updateBatchComponentValue(List<TemplateComponent> components) throws SQLException;

    /**
     * 修改调休组件信息
     *
     * @param leave
     * @throws SQLException
     */
    void updateDaysOffComponent(Leave leave) throws SQLException;

    void updateContent(String content, Integer requestId, Integer num, Integer type) throws SQLException;
}
